package contegor.scire.persistence.prevayler;

import java.util.Date;

import org.prevayler.Query;

import contegor.scire.core.Connectable;
import contegor.scire.core.ReturnPoint;
import contegor.scire.core.Version;
import contegor.scire.structure.ConceptCloud;

/**
 * Prevayler {@link Query} that encapsulates a Scire {@link Query}.
 * 
 * @version $Revision$
 * @author  Héctor Cirbián Pousa ($Author$)
 */
@Version("@(#) $Id$")
public class PrevalentQuery<C extends Connectable> implements Query {

  private contegor.scire.core.queries.Query<C> query;
  private ReturnPoint<C>                       returnPoint;


  public PrevalentQuery(contegor.scire.core.queries.Query<C> query, ReturnPoint<C> returnPoint) {
    super();
    this.query       = query;
    this.returnPoint = returnPoint;
  }

  public Object query(Object prevalentSystem, Date executionTime) throws Exception {
    ((ConceptCloud)prevalentSystem).process(this.query, this.returnPoint);
    return this.returnPoint;
  }

}
